﻿using System;
using System.Collections.Generic;
using System.Text;

using E.Model;
using E.DAL;

namespace E.BLL
{
    public class SurveyBLL
    {
        private SurveyDAL dal;

        public SurveyBLL()
        {
            dal = new SurveyDAL();
        }
        
        /// <summary>
        /// 获取问卷选项类别列表
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetSurveyCategoryList()
        {
            return dal.GetSurveyCategoryList();
        }

        /// <summary>
        /// 获取已存在课程问卷列表
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetExistCourseSurveyList()
        {
            return dal.GetExistCourseSurveyList();
        }

        /// <summary>
        /// 获取已存在认证或项目问卷列表
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetExistCertificateSurveyList()
        {
            return dal.GetExistCertificateSurveyList();
        }

        /// <summary>
        /// 获取未设置问卷课程列表
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetNotSetCourseSurveyList()
        {
            return dal.GetNotSetCourseSurveyList();
        }

        /// <summary>
        /// 获取未设置问卷认证或项目列表
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetNotSetCertificateSurveyList()
        {
            return dal.GetNotSetCertificateSurveyList();
        }

        /// <summary>
        /// 获取课程问卷设置信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public SurveySettingModel GetCourseSurveySetting(int id)
        {
            return dal.GetCourseSurveySetting(id);
        }

        /// <summary>
        /// 获取认证或项目问卷设置信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public SurveySettingModel GetCertificateSurveySetting(int id)
        {
            return dal.GetCertificateSurveySetting(id);
        }

        /// <summary>
        /// 根据类别ID获取选项列表
        /// </summary>
        /// <param name="categoryID"></param>
        /// <returns></returns>
        public IDictionary<int, string> GetSurveyOptionListByCategoryID(int categoryID)
        {
            return dal.GetSurveyOptionListByCategoryID(categoryID);
        }

        /// <summary>
        /// 获取选项信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public SurveyOptionModel GetSurveyOptionInfoById(int id)
        {
            return dal.GetSurveyOptionInfoById(id);
        }

        /// <summary>
        /// 添加问卷选项
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddOption(SurveyOptionModel model)
        {
            return dal.AddOption(model);
        }

        /// <summary>
        /// 更新问卷选项
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpateOption(SurveyOptionModel model)
        {
            return dal.UpateOption(model);
        }

        /// <summary>
        /// 检查选项ID是否存在于课程问卷设置中
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool CheckOptionIDInCourseSurveySetting(string[] id)
        {
            return dal.CheckOptionIDInCourseSurveySetting(id);
        }

        /// <summary>
        /// 检查选项ID是否存在于认证或项目问卷设置中
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool CheckOptionIDInCertificateSurveySetting(string[] id)
        {
            return dal.CheckOptionIDInCertificateSurveySetting(id);
        }

        /// <summary>
        /// 删除问卷选项
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DelOption(string[] id)
        {
            return dal.DelOption(id);
        }

        /// <summary>
        /// 获取问卷选项列表
        /// </summary>
        /// <param name="searchModel"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public SurveyOptionListModel GetSurveyOptionListByCondition(SearchSurveyOptionModel searchModel, int pageSize, int pageIndex)
        {
            return dal.GetSurveyOptionListByCondition(searchModel, pageSize, pageIndex);
        }

        /// <summary>
        /// 获取所有问卷选项列表
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetAllSurveyOptionList()
        {
            return dal.GetAllSurveyOptionList();
        }

        #region 课程

        /// <summary>
        /// 添加课程问卷调查
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddCourseSurveyLog(SurveyLogModel model)
        {
            return dal.AddCourseSurveyLog(model);
        }

        /// <summary>
        /// 获取课程问卷调查信息
        /// </summary>
        /// <param name="examid"></param>
        /// <param name="userid"></param>
        /// <returns></returns>
        public CourseSurveyModel GetCourseSurveyInfo(int examid, int userid)
        {
            return dal.GetCourseSurveyInfo(examid, userid);
        }

        /// <summary>
        /// 获取课程问卷调查信息（内训）
        /// </summary>
        /// <param name="surveyid"></param>
        /// <param name="userid"></param>
        /// <returns></returns>
        public CourseSurveyModel GetCourseSurveyInfo_Internal(int examid, int userid)
        {
            return dal.GetCourseSurveyInfo_Internal(examid, userid);
        }

        /// <summary>
        /// 获取课程问卷调查信息（内训公共课）
        /// </summary>
        /// <param name="examid"></param>
        /// <param name="userid"></param>
        /// <returns></returns>
        public CourseSurveyModel GetCourseSurveyInfo_Internal_P(int examid, int userid)
        {
            return dal.GetCourseSurveyInfo_Internal_P(examid, userid);
        }

        /// <summary>
        /// 获取未参与课程问卷调查列表
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public IDictionary<int, string> GetUnattendedCourseSurveyList(int userid)
        {
            return dal.GetUnattendedCourseSurveyList(userid);
        }

        /// <summary>
        /// 获取未参与课程问卷调查列表（内训）
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public IDictionary<int, string> GetUnattendedCourseSurveyList_Internal(int userid)
        {
            return dal.GetUnattendedCourseSurveyList_Internal(userid);
        }

        /// <summary>
        /// 获取未参与课程问卷调查列表（内训公共课）
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public IDictionary<int, string> GetUnattendedCourseSurveyList_Internal_P(int userid)
        {
            return dal.GetUnattendedCourseSurveyList_Internal_P(userid);
        }

        /// <summary>
        /// 获取未参与项目问卷调查列表（内训）
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public IDictionary<int, string> GetUnattendedCertificateSurveyList_Internal(int userid)
        {
            return dal.GetUnattendedCertificateSurveyList_Internal(userid);
        }

        /// <summary>
        /// 添加课程问卷设置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddCourseSurveySetting(SurveySettingModel model)
        {
            return dal.AddCourseSurveySetting(model);
        }

        /// <summary>
        /// 更新课程问卷设置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpdateCourseSurveySetting(SurveySettingModel model)
        {
            return dal.UpdateCourseSurveySetting(model);
        }

        /// <summary>
        /// 删除课程问卷
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DelCourseSurvey(string[] id)
        {
            return dal.DelCourseSurvey(id);
        }

        #endregion

        #region 认证
        
        /// <summary>
        /// 获取认证问卷调查信息
        /// </summary>
        /// <param name="examid"></param>
        /// <returns></returns>
        public CertificateSurveyModel GetCertificateSurveyInfo(int examid)
        {
            return dal.GetCertificateSurveyInfo(examid);
        }

        /// <summary>
        /// 获取认证问卷调查信息（内训）
        /// </summary>
        /// <param name="surveyid"></param>
        /// <returns></returns>
        public CertificateSurveyModel GetCertificateSurveyInfo_Internal(int surveyid)
        {
            return dal.GetCertificateSurveyInfo_Internal(surveyid);
        }

        /// <summary>
        /// 添加认证问卷调查
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddCertificateSurveyLog(SurveyLogModel model)
        {
            return dal.AddCertificateSurveyLog(model);
        }

        /// <summary>
        /// 获取调查信息
        /// </summary>
        /// <param name="surveyid"></param>
        /// <returns></returns>
        public IDictionary<string, string> GetCertificateVoteInfo(int surveyid)
        {
            return dal.GetCertificateVoteInfo(surveyid);
        }

        /// <summary>
        /// 获取认证调查信息
        /// </summary>
        /// <param name="certificateid"></param>
        /// <returns></returns>
        public CertificateSurveyReportModel GetCertificateSurveyReport(int certificateid)
        {
            return dal.GetCertificateSurveyReport(certificateid);
        }

        /// <summary>
        /// 获取课程问卷调查类别及选项列表
        /// </summary>
        /// <param name="courseid"></param>
        /// <returns></returns>
        public IList<SurveyCategoryAndOptionModel> GetCertificateSurveyCategoryList(int certificateid)
        {
            return dal.GetCertificateSurveyCategoryList(certificateid);
        }

        /// <summary>
        /// 添加认证或项目问卷设置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddCertificateSurveySetting(SurveySettingModel model)
        {
            return dal.AddCertificateSurveySetting(model);
        }

        /// <summary>
        /// 更新认证或项目问卷设置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpdateCertificateSurveySetting(SurveySettingModel model)
        {
            return dal.UpdateCertificateSurveySetting(model);
        }

        /// <summary>
        /// 删除认证或项目问卷
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DelCertificateSurvey(string[] id)
        {
            return dal.DelCertificateSurvey(id);
        }

        #endregion

        #region Analysis

        public ClassUserCountListModel GetClassUserCountList(CourseAnalysisSearchModel searchModel, int pageSize, int pageIndex)
        {
            return dal.GetClassUserCountList(searchModel, pageSize, pageIndex);
        }

        public ClassUserCountListModel GetInternalClassUserCountList(CourseAnalysisSearchModel searchModel, int pageSize, int pageIndex)
        {
            return dal.GetInternalClassUserCountList(searchModel, pageSize, pageIndex);
        }

        public ClassUserCountListModel GetPublicClassUserCountList(CourseAnalysisSearchModel searchModel, int pageSize, int pageIndex)
        {
            return dal.GetPublicClassUserCountList(searchModel, pageSize, pageIndex);
        }

        public IList<CourseSurveyReportModel> GetCourseAnalysisInfo(CourseAnalysisSearchModel searchModel)
        {
            return dal.GetCourseAnalysisInfo(searchModel);
        }

        public IList<CourseSurveyReportModel> GetCourseAnalysisInfo2(string[] classid)
        {
            return dal.GetCourseAnalysisInfo2(classid);
        }

        public IList<CourseSurveyReportModel> GetInternalCourseAnalysisInfo2(string[] classid)
        {
            return dal.GetInternalCourseAnalysisInfo2(classid);
        }

        public IList<CourseSurveyReportModel> GetPublicCourseAnalysisInfo2(string[] classid)
        {
            return dal.GetPublicCourseAnalysisInfo2(classid);
        }

        #endregion
    }
}
